<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/commons/inc.jsp" %>
<script type="text/javascript" src="${contextPath}/js/ajax.js"></script>

<h3 id="navTitleId">胰岛功能</h3>

<body id="body">

<%@include file="/commons/showmessage.jsp" %>

<form name="pancreatform" id="pancreatform" method="post" action="${contextPath}/lab/lab.action?method=saveEditLabPancreat">
	<s:hidden name="pancreatOgtt.seqid" id="pancreatOgtt.seqid"></s:hidden>
	<s:hidden name="pancreatOgtt.patientid" id="pancreatOgtt.patientid"></s:hidden>
	<s:hidden name="pancreatYidaosu.seqid" id="pancreatYidaosu.seqid"></s:hidden>
	<s:hidden name="pancreatYidaosu.patientid" id="pancreatYidaosu.patientid"></s:hidden>
	<s:hidden name="pancreatCtai.seqid" id="pancreatCtai.seqid"></s:hidden>
	<s:hidden name="pancreatCtai.patientid" id="pancreatCtai.patientid"></s:hidden>
	<s:hidden name="patientid" id="patientid"></s:hidden>
	<s:hidden name="ogttSel" id="ogttSel"></s:hidden>
	<s:hidden name="yidaoSel" id="yidaoSel"></s:hidden>
	<s:hidden name="ctaiSel" id="ctaiSel"></s:hidden>
	
	<table border="0" cellspacing="1" cellpadding="0" class="formTable" width="100%" >
		<thead>
			<tr><td width="100%" align="left" class="form-th" colspan="6">胰岛功能</td></tr>
			<tr><td width="34%" align="left" class="form-th" colspan="2">
				<input style="vertical-align:sub;" type="checkbox" name="ogttCB" id="ogttCB" <s:if test="pancreatOgtt.seqid>0">checked</s:if>/><font style="vertical-align:sub;">口服葡萄糖耐量试验（OGTT）：</font>
				<select name="pancreatOgtt.xtlevel" id="pancreatOgtt.xtlevel" onchange="changeSel(this,1, ${patientid})">
						<option value="0" <s:if test="pancreatOgtt.xtlevel==0">selected</s:if>>请选择</option>
						<option value="1" <s:if test="pancreatOgtt.xtlevel==1">selected</s:if>>75g</option>
						<option value="2" <s:if test="pancreatOgtt.xtlevel==2">selected</s:if>>50g</option>
						<option value="3" <s:if test="pancreatOgtt.xtlevel==3">selected</s:if>>100g</option>
				</select></td>
				<td width="33%" align="left" class="form-th" colspan="2">
					<input style="vertical-align:sub;" type="checkbox" name="yidaosuCB" id="yidaosuCB" <s:if test="pancreatYidaosu.seqid>0">checked</s:if>/><font style="vertical-align:sub;">胰岛素释放试验：</font>
					<select name="pancreatYidaosu.ydlevel" id="pancreatYidaosu.ydlevel" onchange="changeSel(this,2, ${patientid})">
							<option value="0" <s:if test="pancreatYidaosu.ydlevel==0">selected</s:if>>请选择</option>
							<option value="1" <s:if test="pancreatYidaosu.ydlevel==1">selected</s:if>>75g</option>
							<option value="2" <s:if test="pancreatYidaosu.ydlevel==2">selected</s:if>>50g</option>
							<option value="3" <s:if test="pancreatYidaosu.ydlevel==3">selected</s:if>>100g</option>
					</select></td>
				<td width="33%" align="left" class="form-th" colspan="2">
					<input style="vertical-align:sub;" type="checkbox" name="ctaiCB" id="ctaiCB" <s:if test="pancreatCtai.seqid>0">checked</s:if>/><font style="vertical-align:sub;">C肽释放试验：</font>
					<select name="pancreatCtai.ctlevel" id="pancreatCtai.ctlevel" onchange="changeSel(this,3, ${patientid})">
							<option value="0" <s:if test="pancreatCtai.ctlevel==0">selected</s:if>>请选择</option>
							<option value="1" <s:if test="pancreatCtai.ctlevel==1">selected</s:if>>75g</option>
							<option value="2" <s:if test="pancreatCtai.ctlevel==2">selected</s:if>>50g</option>
							<option value="3" <s:if test="pancreatCtai.ctlevel==3">selected</s:if>>100g</option>
					</select></td>
			</tr>
		</thead>

		<tbody>
			<tr>
			<td class="form-td"><label class="label">血糖(空腹):</label></td>
			<td class="form-td"><input type="text" name="pancreatOgtt.xtempty" id="pancreatOgtt.xtempty" size="5" value="${pancreatOgtt.xtempty}"/>mmol/L</td>	
			<td class="form-td"><label class="label">胰岛素(空腹):</label></td>
			<td class="form-td"><input type="text" name="pancreatYidaosu.ydempty" id="pancreatYidaosu.ydempty" size="5" value="${pancreatYidaosu.ydempty}"/>pmmol/L</td>
			<td class="form-td"><label class="label">C肽(空腹):</label></td>
			<td class="form-td"><input type="text" name="pancreatCtai.ctempty" id="pancreatCtai.ctempty" size="5" value="${pancreatCtai.ctempty}"/>nmol/L</td>
	 	    </tr>
	 
	 	    <tr>
			<td class="form-td"><label class="label">血糖(30min):</label></td>
			<td class="form-td"><input type="text" name="pancreatOgtt.xthalf" id="pancreatOgtt.xthalf" size="5" value="${pancreatOgtt.xthalf}"/>mmol/L</td>	
			<td class="form-td"><label class="label">胰岛素(30min):</label></td>
			<td class="form-td"><input type="text" name="pancreatYidaosu.ydhalf" id="pancreatYidaosu.ydhalf" size="5" value="${pancreatYidaosu.ydhalf}"/>pmmol/L</td>
			<td class="form-td"><label class="label">C肽(30min):</label></td>
			<td class="form-td"><input type="text" name="pancreatCtai.cthalf" id="pancreatCtai.cthalf" size="5" value="${pancreatCtai.cthalf}"/>nmol/L</td>
	 	   </tr>
	 	
	 		<tr>
			<td class="form-td"><label class="label">血糖(60min):</label></td>
			<td class="form-td"><input type="text" name="pancreatOgtt.xtone" id="pancreatOgtt.xtone" size="5" value="${pancreatOgtt.xtone}"/>mmol/L</td>	
			<td class="form-td"><label class="label">胰岛素(60min):</label></td>
			<td class="form-td"><input type="text" name="pancreatYidaosu.ydone" id="pancreatYidaosu.ydone" size="5" value="${pancreatYidaosu.ydone}"/>pmmol/L</td>
			<td class="form-td"><label class="label">C肽(60min):</label></td>
			<td class="form-td"><input type="text" name="pancreatCtai.ctone" id="pancreatCtai.ctone" size="5" value="${pancreatCtai.ctone}"/>nmol/L</td>
	 		</tr>
	 	
	 		<tr>
			<td class="form-td"><label class="label">血糖(120min):</label></td>
			<td class="form-td"><input type="text" name="pancreatOgtt.xttwo" id="pancreatOgtt.xttwo" size="5" value="${pancreatOgtt.xttwo}"/>mmol/L</td>	
			<td class="form-td"><label class="label">胰岛素(120min):</label></td>
			<td class="form-td"><input type="text" name="pancreatYidaosu.ydtwo" id="pancreatYidaosu.ydtwo" size="5" value="${pancreatYidaosu.ydtwo}"/>pmmol/L</td>
			<td class="form-td"><label class="label">C肽(120min):</label></td>
			<td class="form-td"><input type="text" name="pancreatCtai.cttwo" id="pancreatCtai.cttwo" size="5" value="${pancreatCtai.cttwo}"/>nmol/L</td>
	 		</tr>
	 	
	 		<tr>
			<td class="form-td"><label class="label">血糖(180min):</label></td>
			<td class="form-td"><input type="text" name="pancreatOgtt.xtthree" id="pancreatOgtt.xtthree" size="5" value="${pancreatOgtt.xtthree}"/>mmol/L</td>	
			<td class="form-td"><label class="label">胰岛素(180min):</label></td>
			<td class="form-td"><input type="text" name="pancreatYidaosu.ydthree" id="pancreatYidaosu.ydthree" size="5" value="${pancreatYidaosu.ydthree}"/>pmmol/L</td>
			<td class="form-td"><label class="label">C肽(180min):</label></td>
			<td class="form-td"><input type="text" name="pancreatCtai.ctthree" id="pancreatCtai.ctthree" size="5" value="${pancreatCtai.ctthree}"/>nmol/L</td>
	 		</tr>
	 	
	 		<tr>
			<td align="center" colspan="6">
				<input type="reset" value="重置">
			    <input type="button" onclick="saveEdit('save');" value="保存"></td>
			</tr>
		</tbody>
	</table>
</form>
 
<%@include file="/commons/tableSel.jsp" %>

</body>

<style type="text/css">
body {
	height: 100%;
	width: 100%;
}
</style>

<script>
function saveEdit(type){
	if(!Validator.Validate($('pancreatform'),3)){
		return;
	}	
	if(!$('ogttCB').checked && !$('yidaosuCB').checked && !$('ctaiCB').checked){
		alert("请勾选要保存的项目!");
		return;
	}

	if($('ogttCB').checked){
		var a = $('pancreatOgtt.xtlevel');
		$('pancreatform').ogttSel.value = a.options[a.selectedIndex].value;
	}else{
		$('pancreatform').ogttSel.value = 0;
	}
	if($('yidaosuCB').checked){
		var b = $('pancreatYidaosu.ydlevel');
		$('pancreatform').yidaoSel.value = b.options[b.selectedIndex].value;
	}else{
		$('pancreatform').yidaoSel.value = 0;
	}
	if($('ctaiCB').checked){
		var c = $('pancreatCtai.ctlevel');
		$('pancreatform').ctaiSel.value = c.options[c.selectedIndex].value;
	}else{
		$('pancreatform').ctaiSel.value = 0;
	}
	$('pancreatform').submit();
}
function changeSel(obj, id, patientid){
	var ajax = new postAjax();
	var url,value;
	var sel = obj.options[obj.selectedIndex].value;
	
	if(id==1){
		url = "lab/lab.action?method=searchLabOgtt&";
		value = "patientid=" + patientid + "&ogttSel="+sel;
		ajax.connect(url,value,ogttCallback);
	}else if(id==2){
		url = "lab/lab.action?method=searchLabYidaosu&";
		value = "patientid=" + patientid + "&yidaoSel="+sel;
		ajax.connect(url,value,ydsCallback);
	}else if(id==3){
		url = "lab/lab.action?method=searchLabCtai&";
		value = "patientid=" + patientid + "&ctaiSel="+sel;
		ajax.connect(url,value,ctCallback);
	}
}
function ogttCallback(xmlHttp){
	var re = xmlHttp.responseText;
	if(re=="0"){
		showError($('statusBar'), "查询异常");	
		return;
	}else{		 
		var obj = eval("(" +re+ ")");
		if(obj[0].seqid!=null && obj[0].seqid>0){
			$('pancreatOgtt.xtempty').value = obj[0].xtempty;
			$('pancreatOgtt.xthalf').value = obj[0].xthalf;
			$('pancreatOgtt.xtone').value = obj[0].xtone;
			$('pancreatOgtt.xttwo').value = obj[0].xttwo;
			$('pancreatOgtt.xtthree').value = obj[0].xtthree;
		}else{
			$('pancreatOgtt.xtempty').value = "";
			$('pancreatOgtt.xthalf').value = "";
			$('pancreatOgtt.xtone').value = "";
			$('pancreatOgtt.xttwo').value = "";
			$('pancreatOgtt.xtthree').value = "";
		}
	}
}
function ydsCallback(xmlHttp){
	var re = xmlHttp.responseText;
	if(re=="0"){
		showError($('statusBar'), "查询异常");	
		return;
	}else{
		var obj = eval("(" +re+ ")");
		if(obj[0].seqid!=null && obj[0].seqid>0){
			$('pancreatYidaosu.ydempty').value = obj[0].ydempty;
			$('pancreatYidaosu.ydhalf').value = obj[0].ydhalf;
			$('pancreatYidaosu.ydone').value = obj[0].ydone;
			$('pancreatYidaosu.ydtwo').value = obj[0].ydtwo;
			$('pancreatYidaosu.ydthree').value = obj[0].ydthree;
		}else{
			$('pancreatYidaosu.ydempty').value = "";
			$('pancreatYidaosu.ydhalf').value = "";
			$('pancreatYidaosu.ydone').value = "";
			$('pancreatYidaosu.ydtwo').value = "";
			$('pancreatYidaosu.ydthree').value = "";
		}
	}
}
function ctCallback(xmlHttp){
	var re = xmlHttp.responseText;
	if(re=="0"){
		showError($('statusBar'), "查询异常");	
		return;
	}else{
		var obj = eval("(" +re+ ")");
		if(obj[0].seqid!=null && obj[0].seqid>0){
			$('pancreatCtai.ctempty').value = obj[0].ctempty;
			$('pancreatCtai.cthalf').value = obj[0].cthalf;
			$('pancreatCtai.ctone').value = obj[0].ctone;
			$('pancreatCtai.cttwo').value = obj[0].cttwo;
			$('pancreatCtai.ctthree').value = obj[0].ctthree;
		}else{
			$('pancreatCtai.ctempty').value = "";
			$('pancreatCtai.cthalf').value = "";
			$('pancreatCtai.ctone').value = "";
			$('pancreatCtai.cttwo').value = "";
			$('pancreatCtai.ctthree').value = "";
		}
	}
}
</script>